/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
 */
 
#include <E_DBus.h>
#include <Elementary.h>
#include "dbsqlite.h"

void missed_calls_listener(void);
void ind_missed(void *data, DBusMessage *msg);
void new_sms_listener(void);
void ind_sms(void *data, DBusMessage *msg);
int start_noti_service(void);
void ind_cb(void *data, DBusMessage *msg);
void ind_new_contact(void *data, DBusMessage *msg);
void init_dbus_stuff(void);
void add_sms_opim();
void ind_sys(void *data, DBusMessage *msg);
void get_contacts_count(void *data, DBusMessage *replymsg, DBusError *error);
void get_all_contacts(void);
void get_gps_status(void);
void get_gsm_status(void);
void get_bt_status(void);
void get_wifi_status(void);
void get_brightness(void);

extern int insert_contact_data(_contact *con);
extern int insert_calls_data(_call_data *Call);
extern int insert_sms_data(_sms_data *SMS);
extern void insert_location(char *mess);
extern void begin_transaction(void);
extern void commit_transaction(void);
extern void match_call_name(char *peer, int key, char *na);
extern void match_sms_name(char *peer, int key, char *na);
extern void del_sms_path(char *pa);
extern void add_sms_conv();
extern void match_sms_names(void);
extern void match_call_names(void);
extern void update_sms_sent(char *sms_pa, int i);
extern int add_sms_db(_sms_re *Re, int t);
extern void update_contact_path(char *pa, int i);
extern int add_contact(_add_edit_con *da);
extern void update_contact(_add_edit_con *da);
extern void del_contact_db(char *path);
extern void del_log_entry_db(char *path);
extern void update_state_time(int tm, char *field);
extern void popup_message(char *message, char *msg, int butt_state);
extern void populate_contact_list();
extern void update_contact_db(char *nam, char *phon, char *path);
extern void add_sent_sms(int i, int retry, int ind);
extern void sms_app(void *data, Evas_Object *obj, void *event_info);
extern void get_calls(void);
extern void update_call_db(char *nam, char *phon);
extern void sms_failed_db(char *pa);
extern void sms_sent_db(char *pa);
extern void update_contact_last(char *ty, int ti, int out, char *na);
extern void close_win_sms(void *data, Evas_Object *obj, void *event_info);
extern void conv_list_selected(void *data, Evas_Object *obj, void *event_info);
extern void on_alarm(void *data, DBusMessage *msg);
extern void rtc_set_time(void);
extern void reload_alarms(int *t);

E_DBus_Connection *conn;

extern Evas_Object *win, *ic_sms, *ic_calls, *sms_lb, *call_lb, *log_list, *win, *lb_loc, *conv_list, *add_con_win, *act_win, *win_new_sms;
extern Evas_Object *win_conv, *main_edje, *send_bb;
extern Elm_Genlist_Item_Class itc_log;
extern char launcher_dir[255], hs_add[255];
extern double s_ts, c_ts;
extern _sms_re *sms_bb, Re;
extern _add_edit_con con_save;
extern int show_c_no, reconnect_bt, pidof_btd, count_sms_con, brightness, GSM_st, GPS_st, WiFi_st, bt_st;

Ecore_Timer *reminder_timer;
time_t t;
int no_log, pend_sms, pend_call, pend_noti;
